<article class="module width_3_quarter">
<header>
			<h3 class="tabs_involved"><?php echo (isset($id)) ? 'Update Post' : 'Create Post' ?></h3>
</header>
<div class="module_content">



<?php echo validation_errors('<p class="error">'); ?>


<?php
  
$hidden = array('author_id' => $this -> session -> userdata('user_id'));

if(isset($post['file'])){
	$hidden['file']=$post['file'];
}

echo form_open_multipart((isset($id)) ? "post/edit/".$id : "post/create","",$hidden);

echo form_fieldset();
echo form_label('Article Title', 'title');
echo form_input('title', set_value('title',isset($post['title']) ? $post['title'] : '' ));
echo form_fieldset_close(); 

if(count($categories)>0)
{
echo form_fieldset();
echo form_label('Article', 'category_id');
echo form_dropdown('category_id', $categories,isset($post['category_id']) ? $post['category_id'] : '' );
echo form_fieldset_close(); 
}

else{
	echo "please add a category first";
	
}
echo form_fieldset();
echo form_label('Article', 'article');
echo form_textarea('article', set_value('article',(isset($post['article'])==TRUE) ? $post['article'] : '' ));
echo form_fieldset_close(); 

echo form_fieldset();
echo form_label('File', 'file');
echo form_upload('file');
echo form_fieldset_close(); 


echo form_fieldset();
echo form_label('Title Clean', 'title_clean');
echo form_input('title_clean', set_value('title_clean',isset($post['title_clean']) ? $post['title_clean'] : ''));
echo form_fieldset_close(); 


echo form_fieldset();
echo form_label('Featured', 'featured');
echo form_checkbox('featured', '', (isset($post['featured']) && $post['featured']==1 ) ? (boolean)$post['featured'] : '' );
echo form_fieldset_close(); 


echo form_fieldset();
echo form_label('Enabled', 'enabled');
echo form_checkbox('enabled', '', (isset($post['enabled']) && $post['enabled']==1 ) ? (boolean)$post['enabled'] : '' );
echo form_fieldset_close(); 

echo form_fieldset();
echo form_label('Comments Enabled?', 'comments_enabled');
echo form_checkbox('comments_enabled', '', (isset($post['comments_enabled']) && $post['comments_enabled']==1 ) ? (boolean)$post['comments_enabled'] : '' );
echo form_fieldset_close(); 



?>

<div class="submit_link">
<input type="submit" value="<?php echo (isset($id)) ? 'Update Post' : 'Create Post' ?>" class="alt_btn" />					
</div>


<?php
echo form_fieldset_close(); 

?>

</div>

</article>